import React, { Component } from 'react';
import antd from 'antd';
var { Table } = antd;
import csv from 'v/graph/data/csv'
var { data } = csv

const columns = [{
  title: 'Name',
  dataIndex: 'name'
}, {
  title: 'Parent',
  dataIndex: 'parent'
}]

class WrappedTable extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: true
    };
  }

  componentDidMount() {
    console.log('componentDidMount WrappedTable')
    setTimeout(() => {
      this.setState({
        loading: false
      })
    }, 3000)
  }

  render() {
    return (
      <Table dataSource={data} columns={columns} loading={this.state.loading} rowClassName={(record, index) => {
        return index % 2 === 0 ? '' : 'bg-pink'
      }} expandedRowRender={record => <p style={{ margin: 0 }}>{record.description}</p>} />
    );
  }
}

export default WrappedTable
